package com.ruoyi.web.controller.xinfeng;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.daily.domain.XinfengCustomerTracking;
import com.ruoyi.daily.service.IXinfengCustomerTrackingService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 客户跟踪/回访Controller
 * 
 * @author gyy
 * @date 2025-04-21
 */
@RestController
@RequestMapping("/daily/tracking")
public class XinfengCustomerTrackingController extends BaseController
{
    @Autowired
    private IXinfengCustomerTrackingService xinfengCustomerTrackingService;

    /**
     * 查询客户跟踪/回访列表
     */
    @PreAuthorize("@ss.hasPermi('daily:tracking:list')")
    @GetMapping("/list")
    public TableDataInfo list(XinfengCustomerTracking xinfengCustomerTracking)
    {
        startPage();
        List<XinfengCustomerTracking> list = xinfengCustomerTrackingService.selectXinfengCustomerTrackingList(xinfengCustomerTracking);
        return getDataTable(list);
    }

    /**
     * 导出客户跟踪/回访列表
     */
    @PreAuthorize("@ss.hasPermi('daily:tracking:export')")
    @Log(title = "客户跟踪/回访", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, XinfengCustomerTracking xinfengCustomerTracking)
    {
        List<XinfengCustomerTracking> list = xinfengCustomerTrackingService.selectXinfengCustomerTrackingList(xinfengCustomerTracking);
        ExcelUtil<XinfengCustomerTracking> util = new ExcelUtil<XinfengCustomerTracking>(XinfengCustomerTracking.class);
        util.exportExcel(response, list, "客户跟踪/回访数据");
    }

    /**
     * 获取客户跟踪/回访详细信息
     */
    @PreAuthorize("@ss.hasPermi('daily:tracking:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(xinfengCustomerTrackingService.selectXinfengCustomerTrackingById(id));
    }

    /**
     * 新增客户跟踪/回访
     */
    @PreAuthorize("@ss.hasPermi('daily:tracking:add')")
    @Log(title = "客户跟踪/回访", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody XinfengCustomerTracking xinfengCustomerTracking)
    {
        return toAjax(xinfengCustomerTrackingService.insertXinfengCustomerTracking(xinfengCustomerTracking));
    }

    /**
     * 修改客户跟踪/回访
     */
    @PreAuthorize("@ss.hasPermi('daily:tracking:edit')")
    @Log(title = "客户跟踪/回访", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody XinfengCustomerTracking xinfengCustomerTracking)
    {
        return toAjax(xinfengCustomerTrackingService.updateXinfengCustomerTracking(xinfengCustomerTracking));
    }

    /**
     * 删除客户跟踪/回访
     */
    @PreAuthorize("@ss.hasPermi('daily:tracking:remove')")
    @Log(title = "客户跟踪/回访", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(xinfengCustomerTrackingService.deleteXinfengCustomerTrackingByIds(ids));
    }
}
